<template>
  <div class="container">
    <div class="title">
      <h2>
        {{ advantagesData.beforeTitle
        }}<span>{{ advantagesData.greenTitle }}</span
        >{{ advantagesData.afterTitle }}
      </h2>
      <p>
        {{ advantagesData.content }}
      </p>
    </div>
    <div class="advantages">
      <div
        class="advantage"
        v-for="(item, index) in advantagesData.advantageData"
        :key="index"
      >
        <div class="top">
          <div class="img-container">
            <img :src="item.topImgUrl" alt="topImg" />
          </div>
          <div class="title">{{ item.topTitle }}</div>
        </div>
        <div class="bottom">
          <div class="img-container">
            <img :src="item.bottomImgUrl" alt="bottomImg" />
          </div>
          <div class="title">{{ item.bottomTitle }}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "HomeMainThird",
  props: { advantagesData: Object },
  data() {
    return {};
  },
};
</script>

<style lang="less" scoped>
.container {
  margin: 100px 0;
  width: 100%;

  .title {
    h2 {
      margin: 30px 0;
      font-size: 36px;
      font-weight: 900;
      text-align: center;
      letter-spacing: 7.2px;
      span {
        color: #31c46c;
      }
    }
    p {
      text-align: center;
      font-size: 16px;
      font-weight: 400;
      line-height: 22px;
      letter-spacing: 3.6px;
      color: #8c8c8cff;
    }
  }
  .advantages {
    margin: 50px auto;
    display: flex;
    justify-content: center;
    .advantage {
      width: 150px;
      height: 300px;
      cursor: pointer;
      .top {
        width: 100%;
        height: 150px;
        box-sizing: border-box;
        border-bottom: 1px solid #e5e5e5;
        border-right: 1px solid #e5e5e5;
      }
      &:last-child .top,
      &:last-child .bottom {
        border-right: none;
      }
      .bottom {
        width: 100%;
        height: 150px;
        box-sizing: border-box;
        border-right: 1px solid #e5e5e5;
      }
      .img-container {
        width: 40%;
        height: 40%;
        margin: 0 auto;
        box-sizing: border-box;
        img {
          transform: translateY(30px);
          width: 100%;
          height: 100%;
          object-fit: cover;
        }
      }
      .title {
        text-align: center;
        transform: translateY(40px);
        font-size: 14px;
        letter-spacing: 3.6px;
      }
      .top:hover,
      .bottom:hover {
        box-shadow: 0 15px 34px 0 #9193922b;
        border: none;
        border-bottom: 4px solid #31c46c;
        .img-container {
          width: 45%;
          height: 45%;
          margin: 0 auto;
          box-sizing: border-box;
          img {
            transform: translateY(25px);
          }
        }
        .title {
          transform: translateY(30px);
        }
      }
    }
  }
}
</style>
